﻿namespace com.crownpack.ExportConfigurationDao
{
    using System;

    public partial class ExportConfiguration
    {
        #region Fields

        string _DocumentLibraryUrl;

        #endregion Fields

        #region Properties

        public string DocumentLibraryDescription
        {
            get
            {
                string[ ] s = DocumentLibrary.Split( ',' );
                if ( s.Length >= 1 )
                    return s[ 1 ].Trim( );
                else
                    return string.Empty;
            }
        }

        public string DocumentLibraryUrl
        {
            get
            {
                if ( string.IsNullOrEmpty( _DocumentLibraryUrl ) )
                {
                    string[ ] s = DocumentLibrary.Split( ',' );
                    if ( s.Length >= 1 )
                        _DocumentLibraryUrl= s[ 0 ].Trim( );
                }
                return _DocumentLibraryUrl;
            }
            set
            {
                _DocumentLibraryUrl = value;
            }
        }

        public string ListDescription
        {
            get
            {
                string[ ] s = List.Split( ',' );
                if ( s.Length >= 1 )
                    return s[ 1 ].Trim( );
                else
                    return string.Empty;
            }
        }

        public string ListUrl
        {
            get
            {
                string[ ] s = List.Split( ',' );
                if ( s.Length >= 1 )
                    return s[ 0 ].Trim( );
                else
                    return string.Empty;
            }
        }

        public DateTime? ResolvedLastExport
        {
            get
            {
                return ResetLastExport.HasValue && ResetLastExport.Value ? new Nullable<DateTime>( ) : LastExport;
            }
        }

        #endregion Properties
    }
}